
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter/cupertino.dart';

/// @className : text_widget
/// @date 2022/07/17 00:06 
/// @author : xiaohai
/// @description : 文本封装组件

/// 普通文本组件
Text textWidget(
    title, //文本
    TextStyle textStyle,// 文本样式
    {TextAlign? textAlign, //文本对齐方式
      int? maxLines, //最大行数
      double letterSpacing = 0, //字母间距
      double height = 1.4, //行高
      List<Shadow>? shadow, //文本的阴影
      TextDecoration decoration = TextDecoration.none //文字的线性装饰
    }//文本颜色
        ) {
  return Text(
    title,
    maxLines: maxLines,
    textAlign: textAlign,
    style: textStyle.copyWith(
        height: height,
        letterSpacing: letterSpacing,
        shadows: shadow,
        decoration: decoration
    ),
    strutStyle: StrutStyle(
      //强制改为文字高度
      forceStrutHeight: Platform.isIOS ? false : true,
    ),
  );
}